# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=zmap
pkgver=3.0.0
pkgrel=0
pkgdesc="High performance internet scanner"
url="https://www.zmap.io/"
arch="all"
license="Apache-2.0"
makedepends="
	byacc
	cmake
	flex
	gengetopt
	gmp-dev
	json-c-dev
	libpcap-dev
	libunistring-dev
	linux-headers
	samurai
	"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/zmap/zmap/archive/refs/tags/v$pkgver.tar.gz"

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	cmake -B . -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel
	cmake --build .
}

check() {
	cd test
	./test_big_group.sh
}

package() {
	DESTDIR="$pkgdir" cmake --install .

	install -Dm644 AUTHORS CHANGELOG.md INSTALL.md README.md \
		-t "$pkgdir"/usr/share/doc/$pkgname/
	cp -a examples "$pkgdir"/usr/share/doc/$pkgname/
}

sha512sums="
3ea4d0e4052c2e4ab303f1ac8c35339bd3e282993b7bbd6b75d2a039df934e57f4d93883b5034c5d25e3f8b2e81f3a036cf1bf1fb2ad6620afa6f7fd3366b0f1  zmap-3.0.0.tar.gz
"
